package com.sjzd.nacos.provider;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZFQ
 * @date 2022/2/22
 */
@SpringBootApplication
@EnableDiscoveryClient
public class NacosProvider {
    public static void main(String[] args) {
        SpringApplication.run(NacosProvider.class, args);
    }

    @RestController
    @RefreshScope
    public class TestController {
        @Value("${words:hello}")
        String words;

        @GetMapping("/hello")
        public String hello() {
            return words;
        }
    }
}
